//
//  MainViewController.m
//  ijkPlayer
//
//  Created by apple on 2018/5/14.
//  Copyright © 2018年 锦. All rights reserved.
//

#import "MainViewController.h"
#import "CellViewController.h"
#import "IJKPlayerViewController.h"
#import "NavigationViewController.h"
//#import "FasterCellViewController.h"

@interface MainViewController ()
@property (nonatomic, strong)NavigationViewController *navi;
@end

@implementation MainViewController


-(void)viewWillAppear:(BOOL)animated {
    
    //self.navigationController.navigationBar.hidden = NO;
    
}
- (void)viewWillDisappear:(BOOL)animated {

}
-(void)viewDidAppear:(BOOL)animated {
    _navi._supportLandscape = NO;
    self.navigationController.navigationBar.hidden = NO;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    _navi = (NavigationViewController *)self.navigationController;
    NSArray *titleArr = [NSArray arrayWithObjects:@"test",@"test2",nil];
    CGFloat btnW = 100;
    CGFloat btnH = 40;
    CGFloat x = self.view.frame.size.width / 2 - btnW / 2;
    for (int i = 0; i < titleArr.count; i++) {
        UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(x, 80 + i*(btnH + 10), btnW, btnH)];
        btn.backgroundColor = [UIColor blueColor];
        [btn setTitle:titleArr[i] forState:UIControlStateNormal];
        btn.tag = i;
        [btn addTarget:self action:@selector(nextView:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:btn];
    }
    
    
}

-(void)nextView:(UIButton *)btn {
    switch (btn.tag) {
        case 0:
        {
            [self.navigationController pushViewController:[IJKPlayerViewController new] animated:YES];
        }
            break;
        case 1:
        {
            [self.navigationController pushViewController:[CellViewController new] animated:YES];
        }
            break;
        case 2:
        {
//            [self.navigationController pushViewController:[FasterCellViewController new] animated:YES];
        }
            break;
        default:
            break;
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
